package com.yunji.hushuang.plugin.demo.source;

import java.beans.Transient;

/**
 * @author hushuang
 * @since 2019/10/16
 */
public class Result {

    private String code;

    private String message;

    private Result(String code, String message) {
        this.code = code;
        this.message = message;
    }

    @Transient
    public boolean isSuccess() {
        return "SUCCESS".equals(code);
    }

    @Transient
    public boolean isFail() {
        return "FAIL".equals(code);
    }

    public static Result success() {
        return success("成功");
    }

    public static Result success(String message) {
        return new Result("SUCCESS", message);
    }

    public static Result fail() {
        return fail("失败");
    }

    public static Result fail(String message) {
        return new Result("FAIL", message);
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
